package com.atguigu.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.atguigu.entity.Dict;
import com.atguigu.result.Result;
import com.atguigu.service.DictService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author tangsy
 * @Description TODO
 * @date 2022/9/23 19:39
 * @Version 1.0
 */
@RestController
@RequestMapping("/dict")
public class DictController {

    @Reference
    private DictService dictService;

    @RequestMapping("/findListByDictCode/{dictCode}")
    public Result findListByDictCode(@PathVariable String dictCode){
        //获取指定的字典项列表
        List<Dict> areaList123 = this.dictService.findListByDictCode(dictCode);
        return Result.ok(areaList123);
    }

    @RequestMapping("/findListByParentId/{parentId}")
    public Result findListByParentId(@PathVariable Long parentId){
        List<Dict> plateList = this.dictService.findListByParentId(parentId);
        return Result.ok(plateList);
    }

}
